package com.yc.music.manager;

import ohos.media.audio.AudioManager;

import com.yc.music.service.PlayService;

/**
 * AudioSoundManager
 *
 * @since 2021-05-10
 */
public class AudioSoundManager {
    private AudioManager mAudioManager;

    /**
     * 初始化操作
     *
     * @param content playService对象
     */
    public AudioSoundManager(PlayService content) {
    }

    /**
     * 切换到外放
     */
    public void changeToSpeaker() {
        mAudioManager.setDeviceActive(AudioManager.DEVICE_ID_SPEAKERPHONE, true);
    }

    /**
     * 切换到耳机模式
     */
    public void changeToHeadset() {
        mAudioManager.setDeviceActive(AudioManager.DEVICE_ID_WIRED_HEADSET, false);
    }

    /**
     * 切换到听筒
     */
    public void changeToReceiver() {
        mAudioManager.setDeviceActive(AudioManager.DEFAULT_VOLUME, false);
    }
}
